from info import redis_store
from info.utils.captcha.captcha import captcha
from . import index_blue
from flask import render_template, current_app


# 获取返回，一张图片
@index_blue.route("/image_code")
def img_code():
    name, text, image_data = captcha.generate_captcha()

    return image_data


@index_blue.route("/")
def hello_world():
    # 测试redis存储数据
    # redis_store.set("name","laowang")
    # print(redis_store.get("name"))

    # 测试session存储数据
    # session["age"] = "13"
    # print(session.get("age"))

    # 输入记录信息，可以代替print
    # logging.debug("调试信息1")
    # logging.info("详细信息1")
    # logging.warning("警告信息1")
    # logging.error("错误信息1")

    return render_template("news/index.html")
